<?php


class MessageQueue {
	
	private $queue;
	
	public function MessageQueue() {
		$this->queue = array();
	}
	
	public function addMessage(IMessage $msg) {
		$this->queue[] = $msg;
	}
	
	public function execute() {
		$sendCount = 0;
		foreach ($this->queue as $msg) {
			if ($msg->send()) {
				$sendCount++;
			}
		}
		return $sendCount;
	}
}

interface IMessage
{
	public function send();
}


class DaillyAlertEmail implements IMessage
{
	public function send() {
		// code here to send email
		// ...
		echo "sending email";
	}
}

class DaillyAlertSMS implements IMessage
{
	public function send() {
		// code here to send email
		// ...
		echo "sending SMS";
	}
}